from base import Base
from selenium.webdriver.common.by import By
from time import sleep

class Denglu(Base):
    #点击我的
    djwd = (By.ID,'com.kongfz.app:id/lav_5')
    #账号
    zhname = (By.ID,'com.kongfz.app:id/et_login_name')
    #密码
    zhmm = (By.ID,'com.kongfz.app:id/include_login_pwd')
    #同意协议
    shouquan = (By.ID,'com.kongfz.app:id/iconf_privacy')
    #登录
    dl = (By.ID,'com.kongfz.app:id/tv_confirm_btn')
    #断言
    dy = (By.XPATH,'//android.widget.TextView[@text = 我的订单]')

    def dengluyewu(self,name,password):
        #点击我的
        self.find_ele(self.djwd).click()
        #强制等待13秒
        sleep(13)
        #输入账号
        self.find_ele(self.zhname).send_keys(name)
        sleep(3)
        #输入密码
        self.find_ele(self.zhmm).send_keys(password)
        sleep(3)
        #点击授权
        self.find_ele(self.shouquan).click()
        sleep(3)
        #点击登录
        self.find_ele(self.dl).click()
        sleep(3)

